-
-
Notifications
You must be signed in to change notification settings - Fork 918
input and output class refactoring #2483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good indeed, it's a bit more work then using the request attributes but it'll be cleaner after! Not sure why I didn't do this from scratch :p.
@dunglas I don't know if this is related to your refactor, but I noticed a few things when testing input classes on 2.4-beta
Ideally, It'd be great if you could just define the input_class on the operation, API Platform would then default App\Entity\Book:
collectionOperations:
get: ~
post:
# messenger: false (if you want to make a custom data persister)
input_class: App\DTO\CreateBookRequest |
@ragboyjr thanks for testing!
|
For 2, and 3, are those things you feel like you want to tackle here, or would you welcome a PR addressing those changes? |
PRs are very welcome! |
d3e9f29
to
c3b7d55
Compare
@@ -156,6 +156,7 @@ | |||
<service id="api_platform.listener.view.write" class="ApiPlatform\Core\EventListener\WriteListener"> | |||
<argument type="service" id="api_platform.data_persister" /> | |||
<argument type="service" id="api_platform.iri_converter" on-invalid="null" /> | |||
<argument type="service" id="api_platform.metadata.resource.metadata_factory" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing on-invalid="null"
* input and output class refactoring * Fix WriteListener * Fix unit tests
Does this supports payload on DELETE request? For example asking user to enter his password before deleting some user related entity. |
it should yes. @GregoireHebert worked on a use case where he uses a PUT and did the removal in a messenger handler :D |
Nice then :) |
* @author Antoine Bluchet <soyuka@gmail.com> | ||
*/ | ||
|
||
namespace ApiPlatform\Core\Identifier; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops ?
Alternative to #2481 to get rid of the request attributes and use only the metadata.
TODO: